package com.qixiucoding.listener;

import com.qixiucoding.event.EmailEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author longhj
 * @Date 2022/01/20 星期四 23:21
 */
@Component
public class FAAListener implements ApplicationListener {

    public void onApplicationEvent(ApplicationEvent event) {
        if(event instanceof EmailEvent){
            EmailEvent emailEvent = (EmailEvent)event;
            emailEvent.print();
            System.out.println("theAA source is:"+emailEvent.getSource());
            System.out.println("the AAaddress is:"+emailEvent.address);
            System.out.println("the AAemail's context is:"+emailEvent.text);
        }

    }

}
